#!/usr/local/bin/perl

use strict;
use lib "/home/sgetest/lib";
use TIGR::HTCRequest;
use TIGR::HTCUtils;

# Before starting the test, count the perl processes
my $proc_cnt = TIGR::HTCUtils->get_perl_process_count();
print "Active perl process count is : $proc_cnt \n";
if ($proc_cnt > 20) {
        #print "Active perl process count exceeded max limit of 20. Skipping the launch of new test..\n";
	TIGR::HTCUtils->log_test_skip("test_runsearch");
        exit(1);
}

TIGR::HTCUtils->log_test_start("test_runsearch");
my $h = TIGR::HTCRequest->new(group => "antware_psearch",
                              command => "/local/scratch/vfelix/psearch/build/psearch-1.6/bin/run_search",
                              getenv  => 1,
                              );

$h->add_param("--compress gzip");
$h->add_param("--module blastp --block_id $(Index) --block_size 10 --parameters alignments=50,cutoff=default,database=/local/scratch/vfelix/psearch
/test/data/valid_db.pep,descriptions=100,echofilter=1,expect=0.1,fastafile=/local/scratch/vfelix/search/test/data/valid.pep,filter=seg,matrix=defa
ult,nogap=default,outputdir=/local/scratch/vfelix/,postsw=default,preargs=default,report=btab,wordlength=12 --request_id 10021417 --logfile /local/scratch/vfelix/blastp.$(Index).log");
$h->add_param("--debug debug");
$h->add_param("--__conf__ /local/scratch/vfelix/psearch/etc/psearch.conf");
$h->times(15);
$h->submit();

print $h->to_xml();
TIGR::HTCUtils->log_test_finish("test_runsearch");
exit(0);
